package cn.gan.thymeleaf.controller;

import cn.gan.thymeleaf.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;


@Controller
public class UserController {

    @RequestMapping("/test")
    public ModelAndView index(HttpServletRequest req){
        ModelAndView model = new ModelAndView();
        User user = new User();
        user.setName("甘正胜牛比");
        user.setAge(21);
        user.setAddress("当涂县姑孰镇");
        model.addObject("user",user);
        model.setViewName("show");
        System.out.println(model.getModelMap().get("user"));
        return model;
    }
}
